/*******************************************************************************
* Copyright (c) 2010, 2018 西安秦晔信息科技有限公司
* Licensed under the Apache License, Version 2.0 (the "License");
*    you may not use this file except in compliance with the License.
*    You may obtain a copy of the License at
*
*       http://www.apache.org/licenses/LICENSE-2.0
*
*    Unless required by applicable law or agreed to in writing, software
*    distributed under the License is distributed on an "AS IS" BASIS,
*    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*    See the License for the specific language governing permissions and
*    limitations under the License.
*******************************************************************************/
package com.qinyeit.serviceapp.service.members;
import com.qinyetech.springstage.core.entity.search.Searchable;
import com.qinyetech.springstage.core.service.IBaseService;
import com.qinyeit.serviceapp.entity.DeliveryRecord;
import org.springframework.data.domain.Page;

import java.util.List;
import java.util.Map;

/** 
 * ClassName: DeliveryRecordService <br/> 
 * Function: 配送记录业务功能 <br/> 
 * date: 2018-12-04 11:14:55 <br/> 
 * 
 * @author liuwenjin
 * @version 1.0
 * @since JDK 1.8
 */
public interface DeliveryRecordService extends IBaseService<DeliveryRecord, Long>{

    /**
     * 保存配送明细
     * @param record
     */
    void saveDetail(DeliveryRecord record);

    /**
     * 根据配送明细和会员卡（卡号）左关联后 count 条件vip_id is not NULL and 配送ID
     * @param deliveryId
     * @return
     */
    Long getBindVips(Long deliveryId);

    /**
     * 查看明细
     * @param deliveryId
     * @return
     */
    Page<Map<String,Object>> showDetails(Long deliveryId, Searchable searchable);

    /**
     * 删除配送记录
     *   1.将配送明细对应的会员卡的门店ID置为NULL
     *   2.物理删除配送明细
     *   3.物理删除配送记录
     *   4.更新批量制卡中的已配送数量
     * @param deliveryRecordId
     */
    void deleteData(Long deliveryRecordId);
}